export function getSetting(): Promise<WechatMiniprogram.GetSettingSuccessCallbackResult> {
  return new Promise(( resolve, reject) => {
    wx.getSetting({
      success: res => resolve( res),
      fail : err => reject(err),
      //注释的代码和下方等价
      /*success: resolve,
      fail: reject,*/
    })
  })
}

export function getUserInfo(): Promise<WechatMiniprogram.GetUserInfoSuccessCallbackResult|undefined> {
  return new Promise((resolve, reject)=> {
    wx.getUserInfo({
      success: res => resolve(res),
      fail: err => reject(err),
    })
  })
}
